* support proper scsi disk name
authorsmh22@firebug.cl.cam.ac.uk <smh22@firebug.cl.cam.ac.uk>
Tue, 2 Aug 2005 09:29:56 +0000 (09:29 +0000)
committersmh22@firebug.cl.cam.ac.uk <smh22@firebug.cl.cam.ac.uk>
Tue, 2 Aug 2005 09:29:56 +0000 (09:29 +0000)
* xvd now has an official lanana assigned major, use it

Signed-off-by: Jeremy Katz <katzj@redhat.com>
tools/python/xen/util/blkif.py

index 0caf03b5cf6a179ab22cd6139ed8b15cf47d256c..f877f65f900b3e94925a1b2060dbc921aae7dd68 100644 (file)
@@ -24,8 +24,8 @@ def blkdev_name_to_number(name):
         log.debug("exception looking up device number for %s: %s", name, ex)
         pass
 
-    if re.match( '/dev/sd[a-p]([0-9]|1[0-5])', n):
-        return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
+    if re.match( '/dev/sd[a-p]([1-9]|1[0-5])?', n):
+        return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:] or 0)
 
     if re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
         ide_majors = [ 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 ]
@@ -33,6 +33,9 @@ def blkdev_name_to_number(name):
         minor = ((ord(n[7:8]) - ord('a')) % 2) * 64 + int(n[8:] or 0)
         return major * 256 + minor
 
+    if re.match( '/dev/xvd[a-p]([1-9]|1[0-5])?', n):
+        return 202 * 256 + 16 * (ord(n[8:9]) - ord('a')) + int(n[9:] or 0)
+
     # see if this is a hex device number
     if re.match( '^(0x)?[0-9a-fA-F]+$', name ):
         return string.atoi(name,16)